Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: maintain dependabot config filename for existing configs #150

Merged
merged 8 commits into from
May 30, 2024

Conversation

zkoppert
Copy link
Member

@zkoppert zkoppert commented May 29, 2024

Pull Request

Proposed Changes

In order for us to handle existing configuration files properly, we need to ensure we are making a pull request against the existing configuration and not a new file. This is occurring currently when the file dependabot.yml has a slightly different extension (.yaml).

Minor Changes:

Updates to GitHub Token and Commit Message:

  • README.md: The GH_TOKEN description is updated to specify that it must also have repo:write and workflow privileges to create a pull request.
  • env.py: The default commit message is changed from "Create dependabot.yaml" to "Create/Update dependabot.yaml".

Most significant changes:

Changes in dependabot_file.py:

  • The function make_dependabot_config now takes an additional indent parameter to control the indentation of the generated dependabot.yaml content.
  • The build_dependabot_file function has been updated to calculate the indentation based on the existing dependabot.yaml file, if it exists.
  • The build_dependabot_file function now passes the calculated indent to make_dependabot_config when adding new package managers to the dependabot.yaml file. [1] [2] [3]

Changes in evergreen.py:

  • The main function now keeps track of the filename of the existing dependabot.yaml file, if it exists.
  • The filename of the dependabot.yaml file is now included in the issue body when creating an issue.
  • The commit_changes function now takes additional parameters for the filename of the dependabot.yaml file and the existing configuration. If the configuration exists, it updates the file; otherwise, it creates a new one. [1] [2]

Readiness Checklist

Author/Contributor

  • If documentation is needed for this change, has that been included in this pull request
  • run make lint and fix any issues that you have introduced
  • run make test and ensure you have test coverage for the lines you are introducing
  • If publishing new data to the public (scorecards, security scan results, code quality results, live dashboards, etc.), please request review from @jeffrey-luszcz

Reviewer

  • Label as either fix, documentation, enhancement, infrastructure, maintenance or breaking

@zkoppert zkoppert requested a review from jmeridth as a code owner May 29, 2024 20:31
@github-actions github-actions bot added the fix label May 29, 2024
evergreen.py Outdated Show resolved Hide resolved
@zkoppert zkoppert marked this pull request as draft May 29, 2024 23:39
test_evergreen.py Outdated Show resolved Hide resolved
Copy link
Member

@jmeridth jmeridth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good. gonna approve since you're already gonna fix the filepath issue.

@zkoppert zkoppert marked this pull request as ready for review May 30, 2024 07:17
@zkoppert zkoppert marked this pull request as draft May 30, 2024 07:19
@zkoppert zkoppert marked this pull request as ready for review May 30, 2024 07:20
@zkoppert zkoppert requested a review from jmeridth May 30, 2024 07:26
@zkoppert
Copy link
Member Author

@jmeridth I ended up down a bit of a rabbit hole with this one. I re-requested your review because I changed more than I advertised.

Copy link
Member

@jmeridth jmeridth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple questions/suggestions

README.md Outdated Show resolved Hide resolved
dependabot_file.py Outdated Show resolved Hide resolved
dependabot_file.py Outdated Show resolved Hide resolved
test_dependabot_file.py Outdated Show resolved Hide resolved
@jmeridth jmeridth self-requested a review May 30, 2024 15:58
zkoppert and others added 2 commits May 30, 2024 13:39
Co-authored-by: jmeridth <[email protected]>
Signed-off-by: Zack Koppert <[email protected]>
dependabot_file.py Outdated Show resolved Hide resolved
@zkoppert zkoppert enabled auto-merge May 30, 2024 22:14
@zkoppert zkoppert merged commit b350eab into main May 30, 2024
23 checks passed
@zkoppert zkoppert deleted the maintain-existing-filenames branch May 30, 2024 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants